package com.gxa.business.controller;

import com.gxa.business.service.IndustryService;
import com.gxa.common.base.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/industry")
public class IndustryController {

    @Autowired
    private IndustryService industryService;

    /**
     * 新建行业类型
     * @param name
     * @param status
     * @return
     */
    @RequestMapping(value = "/create",method = RequestMethod.POST)
    public RespResult create(String name,Byte status){
        return industryService.createIndustryInfo(name,status);
    }

    /**
     * 编辑行业类型
     * @param name
     * @param status
     * @return
     */
    @RequestMapping(value = "/edit",method = RequestMethod.POST)
    public RespResult edit(String id,String name,Byte status){
        return industryService.editIndustryInfo(id,name,status);
    }

    /**
     * 下架
     * @param id
     * @return
     */
    @RequestMapping(value = "/updateStatus",method = RequestMethod.POST)
    public RespResult updateStatus(String id){
        return industryService.updateStatus(id);
    }

    /**
     * 查询所有行业类型
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/queryAllIndustryInfo",method = RequestMethod.GET)
    public RespResult queryAllIndustryInfo(int currentPage, int pageSize){
        return industryService.queryAllIndustryInfo(currentPage,pageSize);
    }
}
